<?php /*
Create this table as output. Find the logic behind this and give the output.
*/
//error_reporting(0); 
?>
<?php
/* $a = "ad3bs3f5ds34fj2d4s8n23f1k4s1d3f";
$split = str_split($a);
//print_r($split);
$len =count($split);
$overtotal = 0;
function isNumber($c) {
    return preg_match('/[0-9]/', $c);
} 
		for($i=0; $i<$len; $i++)
		{
			 if(isNumber($split[$i]))
			{
			 $total = $split[$i];
			 $overtotal=$overtotal+$split[$i];
			}
		}
echo 'Sum : ' . $overtotal; */
?>

<html>
<head>
<script type="text/javascript">
function finding()
{
var textvalue = document.getElementById("textvalue").value;
var num=''; var total=0;
//alert(textvalue.length);
for(i=0; i<textvalue.length; i++)
		{
			 if(textvalue.charAt(i)>48 || textvalue.charAt(i)<57 )
			{
			 num = textvalue.substring(i);
			 //alert(num);
			 var total = parseInt(total) + parseInt(i);
			alert(total);
			}
			
			
		}
 //alert(total);
document.getElementById("test").innerHTML = total;
}
</script>
</head>
<body>
<input type="text" id="textvalue" value=" "/>
<input type="button" onclick="finding()" value="check" />
<div id="test"></div>
</body>
</html>













